package ModelLayer;

import java.util.ArrayList;
/**
 * The OrderCon class is a container class, where objects of
 * the type Order can be added and found in a list.
 * The class is incorporated as Singleton.
 * 
 * @author  Mie P., Jakob K., Anna K., Anders A.P., Danny M.P.  
 * @version 1.0
 */
public class OrderCon {

    private ArrayList<Order> orders;
    private static OrderCon  instance;

    /**
     * Constructor for an object of class OrderCon.
     */
    private OrderCon() {

        orders = new ArrayList<Order>();

    }

    /**
     * Singleton. If instance is not created, this method creates the one instance, and returns it.
     * 
     * @return  instance    the singleton instance of OrderCon.
     */
    public static OrderCon getInstance() {

        if(instance == null) {
            instance = new OrderCon();
        }
        return instance;

    }
    
    /**
     * Add an order to the list of orders in the container.
     *
     * @param   o   an Order object
     */
    public void addOrder(Order o) {
        orders.add(o);
   
    }

}